package com.pokerpro.support;

import com.pokerpro.enums.StartingHandCategory;
import com.pokerpro.model.Card;
import com.pokerpro.model.HoleCards;
import static com.pokerpro.support.Log.*;

/**
 * Categories given holecards
 * 
 * @author Martina
 * 
 */
public class CardCategoryScanner {

	private static Card cardLeft;
	private static Card cardRight;

	static StartingHandCategory getCategory(HoleCards cards) {
		cardLeft = cards.getCardLeft();
		cardRight = cards.getCardRight();
		StartingHandCategory category = StartingHandCategory.CRAP;

		/*
		 * Check for premium
		 */
		if (cardLeft.getCardString().contains("a")
				|| cardLeft.getCardString().contains("k")
				|| cardLeft.getCardString().contains("q")) {
			if (cardLeft.getCardString().contains("a")
					|| cardLeft.getCardString().contains("k")
					|| cardLeft.getCardString().contains("q")) {
				category = StartingHandCategory.PREMIUM;
			}
		}

		if (cardLeft.getCardString().contains("a")) {
			if (cardRight.getValue().equals("k"))
				category = StartingHandCategory.PREMIUM;
		}
		if (cardLeft.getCardString().contains("k")) {
			if (cardRight.getValue().equals("a"))
				category = StartingHandCategory.PREMIUM;
		}
		log("Hand Category: " + category);
		return category;
	}
}
